package com.dlc.beijingrfid.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.net.bean.DistributeOrderDetailBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/7/26 0026.
 */

public class DistributeOddDetailAdapter extends RecyclerView.Adapter<DistributeOddDetailAdapter.OddViewHolder> {
    private Context context;
    private List<DistributeOrderDetailBean.DataBean.DetailBean> orderBeanList=new ArrayList<>();
    private LayoutInflater inflater;

    public DistributeOddDetailAdapter(Context context, List<DistributeOrderDetailBean.DataBean.DetailBean> orderBean) {
        this.context = context;
        this.orderBeanList = orderBean;
        this.inflater=LayoutInflater.from(context);
    }

    @Override
    public OddViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new OddViewHolder(inflater.inflate(R.layout.item_distribute_order,parent,false));
    }

    @Override
    public void onBindViewHolder(OddViewHolder holder, int position) {
        Log.d("category_adapter--->",""+orderBeanList.get(position).category);
        holder.name_tv.setText(orderBeanList.get(position).category);
        holder.spec_tv.setText(orderBeanList.get(position).spec);
        holder.num_tv.setText(orderBeanList.get(position).nums);
    }

    @Override
    public int getItemCount() {
        return orderBeanList.size();
    }

    class OddViewHolder extends RecyclerView.ViewHolder{
        private TextView num_tv;
        private TextView name_tv;
        private TextView spec_tv;
        public OddViewHolder(View itemView) {
            super(itemView);
            num_tv= (TextView) itemView.findViewById(R.id.nums);
            name_tv= (TextView) itemView.findViewById(R.id.product_name);
            spec_tv= (TextView) itemView.findViewById(R.id.spec);

        }
    }
}
